package com.prs.crm.action.assets;

import org.apache.struts2.convention.annotation.Action;
import org.courser.struts.BaseAction;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.context.AppContext;
import com.prs.crm.domain.assets.LingYongHistory;
import com.prs.crm.domain.assets.RevertHistory;
import com.prs.crm.service.assets.RevertHistoryService;

public class RevertHistoryAction extends BaseAction{
	private PaginationSupport pagination;
	private Integer[] ids;
	private RevertHistoryService revertHistoryService;
	private RevertHistory revertHistory;
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	public Integer[] getIds() {
		return ids;
	}
	public void setIds(Integer[] ids) {
		this.ids = ids;
	}
	public RevertHistoryService getRevertHistoryService() {
		return revertHistoryService;
	}
	public void setRevertHistoryService(RevertHistoryService revertHistoryService) {
		this.revertHistoryService = revertHistoryService;
	}
	public RevertHistory getRevertHistory() {
		return revertHistory;
	}
	public void setRevertHistory(RevertHistory revertHistory) {
		this.revertHistory = revertHistory;
	}
	/////////////////////////////////////////////////////////////////////////////
	@Action("listRevertHistory")
	public String listRevertHistory(){
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(RevertHistory.class)
		.add(Restrictions.eq("person.id", AppContext.getAccountContext().getUser().getId()));
		this.setPagination(this.revertHistoryService.listByPage(criteria, 
				this.getPaginationHelper().prepare(pagination)));		
		return SUCCESS;
	}
}
